using WorkflowCore.Interface;
using WorkflowCore.Models;
using WorkflowCore.Primitives;

namespace WorkflowApi.Workflows
{
    // 并行执行步骤
    public class ParallelStep : StepBody
    {
        public string ParallelRule { get; set; } = "all"; // all, any, majority
        public List<string> BranchIds { get; set; } = new();
        
        public override ExecutionResult Run(IStepExecutionContext context)
        {
            // 并行执行逻辑
            return ExecutionResult.Next();
        }
    }

    // 等待步骤
    public class WaitStep : StepBody
    {
        public string WaitTime { get; set; } = "5m";
        public string WaitType { get; set; } = "fixed"; // fixed, dynamic, event
        
        public override ExecutionResult Run(IStepExecutionContext context)
        {
            // 等待逻辑
            return ExecutionResult.Next();
        }
    }

    // 脚本执行步骤
    public class ScriptStep : StepBody
    {
        public string ScriptType { get; set; } = "javascript";
        public string ScriptContent { get; set; } = "";
        public int Timeout { get; set; } = 30;
        public string ErrorHandling { get; set; } = "continue";
        
        public override ExecutionResult Run(IStepExecutionContext context)
        {
            // 脚本执行逻辑
            return ExecutionResult.Next();
        }
    }

    // 邮件发送步骤
    public class EmailStep : StepBody
    {
        public string Subject { get; set; } = "";
        public string Body { get; set; } = "";
        public List<string> Recipients { get; set; } = new();
        public List<string> CcRecipients { get; set; } = new();
        
        public override ExecutionResult Run(IStepExecutionContext context)
        {
            // 邮件发送逻辑
            return ExecutionResult.Next();
        }
    }

    // 定时器步骤
    public class TimerStep : StepBody
    {
        public string Schedule { get; set; } = "0 9 * * *"; // Cron表达式
        public string TimerType { get; set; } = "cron"; // cron, interval, delay
        
        public override ExecutionResult Run(IStepExecutionContext context)
        {
            // 定时器逻辑
            return ExecutionResult.Next();
        }
    }

    // Webhook步骤
    public class WebhookStep : StepBody
    {
        public string Url { get; set; } = "";
        public string Method { get; set; } = "POST";
        public Dictionary<string, string> Headers { get; set; } = new();
        public string Body { get; set; } = "";
        
        public override ExecutionResult Run(IStepExecutionContext context)
        {
            // Webhook调用逻辑
            return ExecutionResult.Next();
        }
    }

    // 通知步骤
    public class NotificationStep : StepBody
    {
        public string NotificationType { get; set; } = "sms"; // sms, push, inapp
        public string Message { get; set; } = "";
        public List<string> Recipients { get; set; } = new();
        
        public override ExecutionResult Run(IStepExecutionContext context)
        {
            // 通知发送逻辑
            return ExecutionResult.Next();
        }
    }

    // 子流程步骤
    public class SubprocessStep : StepBody
    {
        public string SubprocessId { get; set; } = "";
        public Dictionary<string, object> Parameters { get; set; } = new();
        
        public override ExecutionResult Run(IStepExecutionContext context)
        {
            // 子流程调用逻辑
            return ExecutionResult.Next();
        }
    }
} 
    }
} 